package pl.edu.mimuw.irs.rcp.controller.command;

import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.commands.Command;

import pl.edu.mimuw.irs.rcp.controller.part.INodeEditPart;

/**
 * @author Jakub Rauch
 * Created on: 2009-05-18
 */
public class NodeMoveCommand extends Command {

	// *** Attributes

	private INodeEditPart nodePart;
	private Rectangle oldBounds;
	private Rectangle newBounds;
	
	// *** Methods

	public NodeMoveCommand(INodeEditPart nodePart, Rectangle oldBounds, Rectangle newBounds)
	{
		super();
		this.nodePart = nodePart;
		this.oldBounds = oldBounds;
		this.newBounds = newBounds;
	}

	public void execute()
	{
		nodePart.moveTo(newBounds);
	}

	public void undo()
	{
		nodePart.moveTo(oldBounds);
	}

}
